Page({
  data: {
    isPlay: false,
    audio: []
  },
  musicsAusio(isPlay) {
    if (isPlay) {
      var audio = this.data.audio
      var url = audio[0].url
      var backAudioManager = wx.getBackgroundAudioManager();
      backAudioManager.src = url
      backAudioManager.title = "徐总"
    } else {
    }
  },
  handleClick() {
    var isPlay = !this.data.isPlay;
    this.setData({
      isPlay
    })
    this.musicsAusio(isPlay)
  },
  onLoad: function () {
    var url = `http://47.108.197.28:3000/song/url?id=1391434224`
    wx.request({
      url,
      header: {'content-type':'application/json'},
      method: 'GET',
      dataType: 'json',
      responseType: 'text',
      success: (res) => {
        console.log(res.data.data)
        this.setData({
          audio: res.data.data
        })
      },
      handleClick(){
        var isPlay = !this.data.isPlay
        this.setData({isPlay})
        this.musicsAusio(isPlay)
    },
     
    });
  }
})